<%--
  Created by IntelliJ IDEA.
  User: cy123
  Date: 2021/11/3
  Time: 19:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="resource/css/index.css">
    <script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
</head>
<body>
    <form:form action="list" method="post" modelAttribute="tj">
        电影名称:<form:input path="name"></form:input>
        上映时间:<form:input path="minDate" type="date"></form:input>
                <form:input path="maxDate" type="date"></form:input>
        价格:<form:input path="min"></form:input>
            <form:input path="max"></form:input>
        简介:<form:input path="content"></form:input>
        <input type="submit" value="查询">
        <table>
            <tr>
                <td>电影编号</td>
                <td>电影名称</td>
                <td>导演</td>
                <td>电影主演</td>
                <td>电影宣传海报</td>
                <td>电影上映时间</td>
                <td>电影价格</td>
                <td>电影简介</td>
                <td>操作<a href="add">新增</a></td>
            </tr>
            <c:forEach items="${pg.list}" var="m">
                <tr>
                    <td>${m.id}</td>
                    <td>${m.name}</td>
                    <td>${m.director.name}</td>
                    <td>${m.star}</td>
                    <td><img src="${m.pic}" width="50" height="50"></td>
                    <td><fmt:formatDate value="${m.date}"></fmt:formatDate></td>
                    <td>${m.price}</td>
                    <td>${m.content}</td>
                    <td><input type="button" onclick="del(${m.id})" value="删除"><input type="button" onclick="up(${m.id})" value="修改"></td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="10" align="center">
                    <button name="pageNum" value="${pg.prePage==0?1:pg.prePage}">上一页</button>
                    <c:forEach items="${pg.navigatepageNums}" var="i">
                        <button value="${i}" name="pageNum">${i}</button>
                    </c:forEach>
                    <button name="pageNum" value="${pg.nextPage==0?pg.pages:pg.nextPage}">下一页</button>
                    当前页:${pg.pageNum}总页数:${pg.pages}
                </td>
            </tr>
        </table>
    </form:form>
    <script>
        function del(id){
            if(confirm("确定要删除吗?")){
                location="del?id="+id;
            }else{
                alert("多谢手下留情");
            }
        }
        function up(id){
            location="sel?id="+id;
        }
    </script>
</body>
</html>
